//
//  HYOUHeadDetailViewController.m
//  BestGift
//
//  Created by 温晓宇 on 16/1/13.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "HYOUHeadDetailViewController.h"
#import "HYOUHeadDetailView.h"
#import "HYOUWebViewController.h"
@interface HYOUHeadDetailViewController ()<HYOUHeadDetailViewDelegate>

@property(nonatomic, retain) HYOUHeadDetailView *headView;

@property(nonatomic ,retain) NSMutableArray *allArray;

@end

@implementation HYOUHeadDetailViewController
//-(void)dealloc{
//    [_allArray release];
//    [_headView release];
//    [_url release];
//    [super dealloc];
//}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.headView = [[HYOUHeadDetailView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT - 64)];
    self.headView.delegate = self;
    [self.view addSubview:self.headView];
//    [_headView release];
    
    NSLog(@"%@",self.url);
    self.allArray = [NSMutableArray array];
    [AppTools finalAFNWithURLString:self.url parameters:nil successAFNBlock:^(id resuposeObject) {
        NSMutableDictionary *bigDic = resuposeObject;
        NSMutableDictionary *data = [bigDic objectForKey:@"data"];
        NSMutableArray *posts = [data objectForKey:@"posts"];
        for (NSDictionary *dic in posts) {
            HYOUOneCellModel *model = [[HYOUOneCellModel alloc] init];
            [model setValuesForKeysWithDictionary:dic];
            [self.allArray addObject:model];
//            [model release];
        }
        self.headView.bigArray = self.allArray;
        
    }];
    
}
-(void)showHeadDetailWeb:(NSString *)url Image:(NSString *)image title:(NSString *)title{
    HYOUWebViewController *web = [[HYOUWebViewController alloc]init];
    web.url = url;
    web.image = image;
    web.name = title;
    [self.navigationController pushViewController:web animated:YES];
//    [web release];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
